<layout name="Index/layout" />

<div class="box-form form-edit">
    <div class="tit">
        <a href="{:U('cloud')}" class="current" >上传配置</a>
    </div>
    <div class="con">
        <form class="AjaxForm" data-action="{:U()}" method="post" >
            <table class="bordered color">
<thead>
    <tr>
        <th colspan="2">
           上传配置
        </th>
    </tr>
    <tr>
        <td>
           上传空间
        </td>
        <td>
            <select id="CloudType" name="FILE_UPLOAD_TYPE">
            <foreach name="FILE_UPLOAD_TYPE.extra" item="v" key="k">
            <option value="{$k}" <eq name="FILE_UPLOAD_TYPE.value" value="$k">selected</eq> >{$v}</option>
            </foreach>
            </select>
        </td>
    </tr>
</thead>

<tbody class="Local InputBody" style="display:none">
    <tr>
        <th colspan="2">图片水印处理</th>
    </tr>
    <tr>
        <td>开启水印:</td>
        <td>
            <input id="UPLOAD_WATER_1" type="radio" name="UPLOAD_WATER" value="1" <eq name="UPLOAD_WATER['value']" value="1">checked</eq> >
            <label for="UPLOAD_WATER_1">开启</label>
            <input id="UPLOAD_WATER_0" type="radio" name="UPLOAD_WATER" value="0" <eq name="UPLOAD_WATER['value']" value="0">checked</eq> >
            <label for="UPLOAD_WATER_0">关闭</label>
            <span class="input-tip">是否开启加盖水印</span>
        </td>
    </tr>
    <tr>
        <td>水印路径:</td>
        <td>
            <input type="text" name="UPLOAD_WATER_PATH" value="{$UPLOAD_WATER_PATH['value']}">
            <img src="/{$UPLOAD_WATER_PATH['value']}" width="80" height="40">
            <span class="input-tip">水印图片路径,提交后预览图更新</span>
        </td>
    </tr>
    <tr>
        <th colspan="2">图片缩放处理</th>
    </tr>
    <tr>
        <td>缩略图宽度:</td>
        <td>
            <input type="text" name="UPLOAD_THUMB_WIDTH" value="{$UPLOAD_THUMB_WIDTH['value']}">
             <span class="input-tip">单位为px</span>
        </td>
    </tr>
    <tr>
        <td>缩略图高度:</td>
        <td>
            <input type="text" name="UPLOAD_THUMB_HEIGHT" value="{$UPLOAD_THUMB_HEIGHT['value']}">
            <span class="input-tip">单位为px</span>
        </td>
    </tr>
</tbody>

<tbody class="Upyun InputBody" style="display:none">
    <tr>
        <th colspan="2">空间信息填写</th>
    </tr>
    <tr>
        <td>又拍云空间名称</td>
        <td>
            <input type="text" name="UPLOAD_TYPE_CONFIG_UPYUN[bucket]" value="{$UPLOAD_TYPE_CONFIG_UPYUN['value']['bucket']}" >
        </td>
    </tr>
    <tr>
        <td>又拍云空间域名</td>
        <td>
            <input type="text" name="UPLOAD_TYPE_CONFIG_UPYUN[domain]" value="{$UPLOAD_TYPE_CONFIG_UPYUN['value']['domain']}" >
        </td>
    </tr>
    <tr>
        <td>又拍云服务器</td>
        <td>
            <input type="text" name="UPLOAD_TYPE_CONFIG_UPYUN[host]" value="{$UPLOAD_TYPE_CONFIG_UPYUN['value']['host']}" >
        </td>
    </tr>
    <tr>
        <td>又拍云空间账号</td>
        <td>
            <input type="text" name="UPLOAD_TYPE_CONFIG_UPYUN[username]" value="{$UPLOAD_TYPE_CONFIG_UPYUN['value']['username']}" >
        </td>
    </tr>
    <tr>
        <td>又拍云空间密码</td>
        <td>
            <input type="password" name="UPLOAD_TYPE_CONFIG_UPYUN[password]" value="{$UPLOAD_TYPE_CONFIG_UPYUN['value']['password']}" >
        </td>
    </tr>
<tbody>
<tbody class="Qiniu InputBody" style="display:none">
    <tr>
        <th colspan="2">空间信息填写</th>
    </tr>
    <tr>
        <td>七牛空间名称</td>
        <td>
            <input type="text" name="UPLOAD_TYPE_CONFIG_QINIU[bucket]" value="{$UPLOAD_TYPE_CONFIG_QINIU['value']['bucket']}" >
            <span class="input-tip">bucket 空间名称</span>
        </td>
    </tr>
    <tr>
        <td>七牛空间域名</td>
        <td>
            <input type="text" name="UPLOAD_TYPE_CONFIG_QINIU[domain]" value="{$UPLOAD_TYPE_CONFIG_QINIU['value']['domain']}" >
            <span class="input-tip">domain 空间域名</span>
        </td>
    </tr>
    <tr>
        <td>七牛服务器密钥</td>
        <td>
            <input type="text" name="UPLOAD_TYPE_CONFIG_QINIU[secrectKey]" value="{$UPLOAD_TYPE_CONFIG_QINIU['value']['secrectKey']}" >
            <span class="input-tip">secrectKey <a href="https://portal.qiniu.com/setting/key" target="_blank">SK查询</a></span>
        </td>
    </tr>
    <tr>
        <td>七牛用户密钥</td>
        <td>
            <input type="text" name="UPLOAD_TYPE_CONFIG_QINIU[accessKey]" value="{$UPLOAD_TYPE_CONFIG_QINIU['value']['accessKey']}" >
            <span class="input-tip">accessKey <a href="https://portal.qiniu.com/setting/key" target="_blank">AK查询</a></span>
        </td>
    </tr>
</tbody>
            <tbody class="SubmitBtn">
                <tr>
                    <th colspan="2">上传限制</th>
                </tr>
                <tr>
                    <td>允许上传类型:</td>
                    <td>
                        <textarea name="UPLOAD_ALLOW">{$UPLOAD_ALLOW['value']}</textarea>
                        <span class="input-tip">文件后缀</span>
                    </td>
                </tr>
                <tr>
                    <td>允许上传大小:</td>
                    <td>
                        <input type="text" name="UPLOAD_MAXSIZE" value="{$UPLOAD_MAXSIZE['value']}">
                        <span class="input-tip">单位为KB</span>
                    </td>
                </tr>
                <tr>
                    <td class="td-2" colspan="2">
                        <input type="submit" class="btn-big btn-blue" value="提交">
                    </td>
                </tr>
            </tbody>
            </table>
        </form>
    </div>
</div>



<script type="text/javascript">
$(function(){

    $("#CloudType").change(function(){

        $('.InputBody').hide().find('input').prop("disabled", true);
        var tr = $(this).val();
        if($('.'+tr).length){
            $('.'+tr).show().find('input').prop("disabled", false);
        }
    }).change();

});
seajs.use(['ajax'],function(ajax){
    ajax.form();
});
</script>